#include "precompile.h"

#include "ImageEventHandler.h"
#include "command/arg/ImageItemArgument.h"

ImageEventHandler::ImageEventHandler()
{
}

ImageEventHandler::~ImageEventHandler()
{
}

Tracker* ImageEventHandler::BeginTrack()
{
	return new RectTracker();
}

bool ImageEventHandler::EndTrack(SystemEventArgs* /*e*/,const Point& begin,const Point& end)
{
	Point rbegin = interaction->CalcRelativePoint(begin);
	Point rend = interaction->CalcRelativePoint(end);

	ImageEventInfo* info = (ImageEventInfo*)eventInfo;
	ImageItemArgument arg(rbegin,rend,info->filePath);
	GetApplication()->GetController()->ExecuteCommand(Commands::CreateImageItem,&arg);
	return true;
}